#ifndef SQL_QUERY_H
#define SQL_QUERY_H

#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtSql/QSqlRecord>
#include "dbmanager/dbmanager_global.h"

namespace dbmanager {

class QueryHandler;
class SqlQueryPrivate;

class DBMANAGER_EXPORT SqlQuery : public QObject {
  Q_OBJECT
public:
  SqlQuery(bool return_result = true, bool use_transaction = false);

  ~SqlQuery();

  void add(const QString &query);

  bool success() const;

  bool returnResult() const;

  bool useTransaction() const;

  int getFaultCode() const;

  QString getFaultString() const;

  QList<QString> queries() const;

  QList<QSqlRecord *> results() const;

signals:

  void executed();

private:

  friend class QueryHandler;

  friend class SqlQueryPrivate;

  SqlQueryPrivate *p;
};

} // namespace dbmanager

#endif // SQL_QUERY_H
